<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <div>
      <h1>Flow对象类型</h1>
    </div>
    <script>
      // 第一种
      const obj1: { foo: string, bar: number } = { foo: "string", bar: 100 };
      //第二种加问号,代表可写可不写
      const obj1: { foo?: string, bar: number } = { bar: 100 };
      //第三种--代表可以添加任意键--但是要符合类型
      const obj3: { [string]: string } = {};
      obj3.key1 = "value1";
      obj3.key2 = "value2";
    </script>
  </body>
</html>
